<?php
// Copyright 2019 Hackware SpA <human@hackware.cl>
// This file is part of "Hackware Web Services Wallet" and licensed under
// the terms of the GNU Affero General Public License version 3, or (at your
// option) a later version. You should have received a copy of this license
// along with the software. If not, see <https://www.gnu.org/licenses/>.

namespace Hawese\Wallet\Policies;

use Hawese\Core\User;
use Hawese\Wallet\Wallet;

class WalletPolicy
{
    /**
     * Reserved to super user
     */
    public function list(User $user): bool
    {
        return false;
    }

    /**
     * Reserved to super user
     */
    public function create(User $user): bool
    {
        return false;
    }

    /**
     * Only a wallet owner can read its wallet
     */
    public function read(User $user, Wallet $wallet): bool
    {
        return $wallet->isOwner($user);
    }
}
